Skip to content

refactor(rust): simplify FFI array operations using view helpers#8

Merged
CodeWithKyrian merged 1 commit intomainfrom
refactor/simplify-ffi-operations
Mar 23, 2026
Merged

refactor(rust): simplify FFI array operations using view helpers#8
CodeWithKyrian merged 1 commit intomainfrom
refactor/simplify-ffi-operations

Conversation

@CodeWithKyrian
Copy link
Copy Markdown
Contributor

This PR refactors the copy, fill, and assign FFI operations to use standardized view extraction helpers, eliminating redundant wrapper methods and macros.

Motivation and Context

The wrapper module contained multiple macro-generated methods (copy_view_*, fill_slice_, assign_slice_) that duplicated view extraction logic. By moving this logic directly into the FFI functions and using standardized view helpers, we create a cleaner separation of concerns where the wrapper only contains essential functionality while the FFI layer handles operation-specific logic.

What's Changed

  • Refactored ffi/array/copy.rs to use extract_view_* helpers
  • Refactored ffi/indexing/fill.rs to use extract_view_mut_* helpers
  • Refactored ffi/indexing/assign.rs to inline all assignment logic
  • Added define_extract_view_mut macro for mutable view extraction
  • Added mutable view extraction functions to helpers/view.rs
  • Removed impl_copy_view, impl_fill_slice and impl_assign_slice macros
  • Simplified assign logic to conditionally use to_owned() only for same-array case

Breaking Changes

None. All changes are internal to the Rust crate. The FFI interface and PHP API remain unchanged.

Refactor FFI array operations to use standardized view extraction helpers instead of wrapper methods. Removes redundant macros and simplifies the wrapper module by inlining operation logic directly in FFI functions.
@CodeWithKyrian CodeWithKyrian merged commit 4ba43cb into main Mar 23, 2026
14 checks passed
@CodeWithKyrian CodeWithKyrian deleted the refactor/simplify-ffi-operations branch March 23, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant